﻿@{
    ViewBag.Title = "PartnerWork";
    Layout = "~/Views/Shared/Template.cshtml";
}

<!-- 添加样式 -->
<style>
    .AddStyle {
        text-align: center;
        height: 60px;
        border: 1px dashed black;
        border-radius: 10px;
        margin-left: 20px;
    }

    th {
        text-align: center;
    }
</style>

<div class="bgcSil overHid pr">
    <div class="right-window"></div>
    <div class="container huobanwork">
        伙办 >
        伙办办公
    </div>
    <!-- 那四个筛选条件 -->
    <div class="clearfix container ">
        <div class="select-title">
            <div class="select-quyu">
                <ul class="clearfix select-quyu-ul">
                    <li class="fl">筛选条件 :</li>
                    <li id="cityAdd" class="fl city"></li>
                    <li class="fl ere"></li>
                    <li class="fl businessn"></li>
                    <li class="fl price" id="priceAdd"></li>
                    <li class="fl mianj" id="mjAdd"></li>
                    <li class="fl zhuangx" id="zxAdd"></li>
                </ul>
            </div>
            <table class="table-list">
                <tr id="City">
                    <th>城市：</th>
                    <td data-val="0" name="北京" class="city ">北京</td>
                    <td data-val="1" name="上海" class="city ">上海</td>
                    <td data-val="2" name="郑州" class="city ">郑州</td>
                    <td data-val="2" name="鹤壁" class="city ">鹤壁</td>
                </tr>
                <tr id="area" style="display:none;">
                    <th>区域：</th>
                </tr>
                <tr id="busyArea" style="display:none;">
                    <th>商圈：</th>
                </tr>
                <tr id="Price">
                    <th>价格(千元/月)：</th>
                    <td class="price priceSelect priceSelect0 " data-val="0">1以下</td>
                    <td class="price priceSelect priceSelect0 " data-val="1">1-3</td>
                    <td class="price priceSelect priceSelect0 " data-val="2">3-5</td>
                    <td class="price priceSelect priceSelect0 " data-val="3">5-10</td>
                    <td class="price priceSelect priceSelect0 " data-val="4">10以上</td>
                </tr>
                <tr id="Mj">
                    <th>面积：</th>
                    <td data-val='0' class="proportion_type ">100m<sup>2</sup></td>
                    <td data-val='1' class="proportion_type ">100-200m<sup>2</sup></td>
                    <td data-val='2' class="proportion_type ">200-300m<sup>2</sup></td>
                    <td data-val='3' class="proportion_type ">300-500m<sup>2</sup></td>
                    <td data-val='4' class="proportion_type ">500-1000m<sup>2</sup></td>
                    <td data-val='5' class="proportion_type ">>1000m<sup>2</sup>以上</td>
                </tr>
                <tr id="Zx">
                    <th>装修：</th>
                    <td data-val="0" class="degree ">毛坯</td>
                    <td data-val="1" class="degree ">精装</td>
                    <td data-val="2" class="degree ">简装</td>
                    <td data-val="3" class="degree ">吊白网</td>
                    <td data-val="4" class="degree ">遗留装修</td>
                </tr>
                <tr></tr>
            </table>
        </div>
        <p class="fn-mt20 fn-mb20">共找到<span id="houseCount" class="homeNum fn-font-clor-red">  </span>套办公房源</p>
        <div class="news-list-con fn-mb140 bgcWhit">
            <div class="news-list-info" id="houseBox">
                <ul id='messageBox'></ul>
            </div>
        </div>
    </div>
    <input type="hidden" id="GetLoginName" value="@Session["LoginUserName"]" />

    <a href="#head"><i class="icon-top pa" style=" bottom: 50px;left: 50%"></i></a>
    @*<input id="more" value="查看更多" type="button">*@
</div>

<script>

    $(function () {
        load();
    })
    function load() {
        var cityname = $("#cityAdd").text().substr(3, $("#cityAdd").text().length);
        var price = $("#priceAdd").text().substr(3, $("#priceAdd").text().length);
        var mjadd = $("#mjAdd").text().substr(3, $("#mjAdd").text().length);
        var zxadd = $("#zxAdd").text().substr(3, $("#zxAdd").text().length);
        $.ajax({
            type: "post",
            url: "/Partner/coll",
            data: { htype: "伙办办公", cityname: cityname, price: price, mjadd: mjadd, zxadd: zxadd },
            dataType: "Json",
            async: false,
            success: function (data) {
                $("#messageBox").empty();
                var strHtml = "";
                for (var i = 0; i < data.length; i++) {
                    var ID = data[i].House_Id;
                    if (data[i].Usecoll == 1) { // 已收藏
                        strHtml += "<li hoseid=\"adbedfc63077473997f9dfc9e23ea6e6\" class=\"fcBlack pr\"><a class=\"fl\"  href='/HouseMessage/HouseMessage?House_Id=" + ID + "' target=\"_blank\"><img src=\"http://47.93.33.136:8080/userfiles/1/images/adminReleaseRoom/img/2017/08/fangjian.jpg\" alt=\"" + data[i].House_Name + " -" + data[i].House_Telphone + "\" /></a><div class=\"news-note\"><div class=\"fl\"><h3><a class=\"fcBlack\"  href='/HouseMessage/HouseMessage?House_Id=" + ID + "' target=\"_blank\" title=\"" + data[i].House_Name + " -" + data[i].House_Telphone + "\">" + data[i].House_Name + "-" + data[i].House_Telphone + "</a></h3><p class=\"p\"><span>面积</span>&nbsp;&nbsp;&nbsp;<span>" + data[i].House_Area + " m<sup>2</sup> | " + data[i].House_Decorate + "</span></p><p>地址 ： " + data[i].House_Address + "</p><br /></div><div class=\" fr\"><p>租<span style=\"color: red;font-size: 30px\">" + data[i].House_Price + "</span><img src=\"file:///C:\Users\lilili\AppData\Local\Temp\SGPicFaceTpBq\8376\0AE5B7E8.png\" />千元/月</p><p class=\"collect\" style=\"color:#979797; cursor:pointer; width:100px; \" data-id=\"adbedfc63077473997f9dfc9e23ea6e6\"  onclick='shouchang(this," + data[i].House_Id + ")' islogin=\"88aa99aa389d47a098d310014df253e1\" state=\"0\"><i class=\"icon-heart3\"  style=\"margin:0 10px;\"></i><span>已收藏</span></p></div></div></li>";
                    }
                    if (data[i].Usecoll == 0) {  //未收藏
                        strHtml += "<li hoseid=\"adbedfc63077473997f9dfc9e23ea6e6\" class=\"fcBlack pr\"><a class=\"fl\"  href='/HouseMessage/HouseMessage?House_Id=" + ID + "' target=\"_blank\"><img src=\"http://47.93.33.136:8080/userfiles/1/images/adminReleaseRoom/img/2017/08/fangjian.jpg\" alt=\"" + data[i].House_Name + " -" + data[i].House_Telphone + "\" /></a><div class=\"news-note\"><div class=\"fl\"><h3><a class=\"fcBlack\"  href='/HouseMessage/HouseMessage?House_Id=" + ID + "' target=\"_blank\" title=\"" + data[i].House_Name + " -" + data[i].House_Telphone + "\">" + data[i].House_Name + "-" + data[i].House_Telphone + "</a></h3><p class=\"p\"><span>面积</span>&nbsp;&nbsp;&nbsp;<span>" + data[i].House_Area + " m<sup>2</sup> | " + data[i].House_Decorate + "</span></p><p>地址 ： " + data[i].House_Address + "</p><br /></div><div class=\" fr\"><p>租<span style=\"color: red;font-size: 30px\">" + data[i].House_Price + "</span><img src=\"file:///C:\Users\lilili\AppData\Local\Temp\SGPicFaceTpBq\8376\0AE5B7E8.png\" />千元/月</p><p class=\"collect\" style=\"color:#979797; cursor:pointer; width:100px; \" data-id=\"adbedfc63077473997f9dfc9e23ea6e6\"  onclick='shouchang(this," + data[i].House_Id + ")' islogin=\"88aa99aa389d47a098d310014df253e1\" state=\"0\"><i class=\"icon-heart2\"  style=\"margin:0 10px;\"></i><span>收藏</span></p></div></div></li>";
                    }
                }
                $("#messageBox").append(strHtml);
                $("#houseCount").text(data.length);
            }
        })
    }

    //房源收藏
    function shouchang(obj, id) {
        var Name = $("#GetLoginName").val();
        if (Name == null || Name == "") {
            layer.tips('请先登录', obj, {
                tips: [1, 'red'],
                time: 2000
            });
        }
        else {
            $.ajax({
                type: "post",
                url: "/Partner/HouseCollect",
                data: { id: id },
                success: function (result) {
                    if (result == 1) {
                        // 收藏成功
                        $(obj).html("<i class=\"icon-heart3\" style=\"margin:0 10px;\"></i><span>已收藏</span>");
                    }
                    if (result == 2) {
                        // 取消收藏成功
                        $(obj).html("<i class=\"icon-heart2\" style=\"margin:0 10px;\"></i><span>收藏</span>");
                    }
                }
            })
        }
    }
    //伙办办公
    $(function () {
        //城市
        $("#City td").click(function () {
            var cityName = $(this).text();
            $("#cityAdd").text("城市：" + cityName);
            $("#cityAdd").addClass("AddStyle");
            $("#City").hide();
            load();
        })
        $("#cityAdd").click(function () {
            var cityName = $(this).text();
            $("#cityAdd").empty();
            $("#cityAdd").removeClass("AddStyle");
            $("#City").show();
            load();
        })

        //价格
        $("#Price td").click(function () {
            var txtPrice = $(this).text();
            $("#priceAdd").text("价格：" + txtPrice);
            $("#priceAdd").addClass("AddStyle");
            $("#Price").hide();
            load();
        })
        $("#priceAdd").click(function () {
            var txtPrice = $(this).text();
            $("#priceAdd").empty();
            $("#priceAdd").removeClass("AddStyle");
            $("#Price").show();
            load();
        })

        //面积
        $("#Mj td").click(function () {
            var txtMj = $(this).text();
            $("#mjAdd").text("面积：" + txtMj);
            $("#mjAdd").addClass("AddStyle");
            $("#Mj").hide();
            load();
        })
        $("#mjAdd").click(function () {
            var txtMj = $(this).text();
            $("#mjAdd").empty();
            $("#mjAdd").removeClass("AddStyle");
            $("#Mj").show();
            load();
        })

        //装修
        $("#Zx td").click(function () {
            var txtZx = $(this).text();
            $("#zxAdd").text("城市：" + txtZx);
            $("#zxAdd").addClass("AddStyle");
            $("#Zx").hide();
            load();
        })
        $("#zxAdd").click(function () {
            var txtZx = $(this).text();
            $("#zxAdd").empty();
            $("#zxAdd").removeClass("AddStyle");
            $("#Zx").show();
            load();
        })
    })
</script>
